package com.zrkizzy.seckill.controller.tool;

import com.zrkizzy.seckill.entity.User;
import com.zrkizzy.seckill.vo.common.Result;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 测试控制器
 *
 * @author zhangrongkang
 * @since 2023/3/20
 */
@Controller
@RequestMapping("/test")
public class TestController {

    /**
     * 测试页面跳转
     *
     * @param model 页面信息
     * @return 测试页面
     */
    @GetMapping("/")
    public String hello(Model model) {
        model.addAttribute("name", "世纪末的架构师");
        return "hello";
    }

    /**
     * 测试用户信息
     *
     * @param user 用户信息
     * @return 前端响应对象
     */
    @RequestMapping ("/user/info")
    @ResponseBody
    public Result userInfo(User user) {
        return Result.success(user);
    }

}
